<?php
/**
 * 用户
 *
 *
 */


class orderitem_model extends CI_Model
{
	const tableName = "orderitem";
	
	var $orderId;

	var $foodId;
	
	var $quantity;

	var $subtotal;

	function __construct()
	{
		parent::__construct();
	}

	// --------------------------------------------------------------------

	/**
	 *
	 * 插入user数据
	 */
	function insert_orderitem($data)
	{
		$this->orderId = $data['orderID'];	
		$this->foodId = $data['foodID'];
		$this->quantity = $data['quantity'];	
		$this->subtotal = $data['subtotal'];
		
		$this->db->insert(self::tableName, $this);
	}
		
	
	function getOrderitemByIdarray($idArray)
	{
		if(count($idArray)<=0)
		{
			return array();
		}
		$idStr = implode(',', $idArray);
		$idStr = substr($idStr, 2);
		$query = $this->db->query("select * from ".self::tableName." where id in ({$idStr})");
		//$query = $this->db->query("select * from ".self::tableName." where resutaurantId = ".$restaurantid);
		return $query->result() ;
		
	}
}